package com.css.bjdt_core.report.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import com.css.bjdt_core.executive.report.ReportRequest;
import com.css.bjdt_core.report.entity.RptTemplateUnitRela;
import com.css.bjdt_core.util.CommonUtil;

@Service
public class ReportTemplateUnitRelaService {
	/**
	 * 根据报表请求获取党组织和报表的关系
	 * @param request 报表请求
	 * @return
	 */
	public List<RptTemplateUnitRela> getTemplateUnitRela(ReportRequest request) {
		List<String> templateIds = request.getTemplateIds();
		List<RptTemplateUnitRela> templateUnitRelaList = new ArrayList<RptTemplateUnitRela>();
		for (String templateId : templateIds) {
			RptTemplateUnitRela templateUnitRela = new RptTemplateUnitRela();
			templateUnitRela.setId(CommonUtil.getUUID());
			templateUnitRela.setAnnualId(request.getAnnualId());
			templateUnitRela.setTemplateId(templateId);
			templateUnitRela.setReportUnitId(request.getReportDzzId());
			templateUnitRela.setUnitIds(request.getDzzIds());
			templateUnitRela.setFullName(request.getReportDzzName());
			templateUnitRela.setRelMan(request.getReportMan());
			templateUnitRela.setStartTime(request.getStartTime());
			templateUnitRela.setEndTime(request.getEndTime());
			templateUnitRela.setSesssionDzzId(request.getReportDzzId());
			templateUnitRela.setBatchId(request.getBatchId());
			//templateUnitRela.setValidationReportType(request.getValidationReportType());
			templateUnitRelaList.add(templateUnitRela);
		}
		return templateUnitRelaList;
	}

}
